package com.jy.controller;


import com.jy.common.enums.ResponseWrapper;
import com.jy.service.GoodCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商品分类表 前端控制器
 * </p>
 *
 * @author fzg
 * @since 2024-12-21
 */
@RestController
@RequestMapping("/good-category")
public class GoodCategoryController {

    private final GoodCategoryService goodCategoryService;

    public GoodCategoryController(GoodCategoryService goodCategoryService) {
        this.goodCategoryService = goodCategoryService;
    }


    /**
     * 获取商品分类列表（列表里面包含所有商品）
     * @return ResponseWrapper
     */
    @GetMapping("/getGoodsCategoryList")
    public ResponseWrapper getGoodsCategoryList(){
        return goodCategoryService.getGoodsCategoryList();
    }


    /**
     * 根据分类aid获取商品
     * @return ResponseWrapper
     */
    @GetMapping("/getGoodByCategoryAid")
    public ResponseWrapper getGoodByCategoryAid(@RequestParam Integer categoryAid){
        return goodCategoryService.getGoodByCategoryAid(categoryAid);
    }

}
